'use strict';
var Schema = require('mongoose').Schema,
    Model = require('../../../Base/server/controllers/Model'),
    CBOEnum = require('../controllers/Enum.server.controller');

var modelField = {
    TerminalCode: {
        type: String,
        Name: '终端编码',
        IsEmpty: false
    },
    TerminalName: {
        type: String,
        Name: '终端名称'
    },
    TerminalUniqueID: {
        type: String,
        Name: '终端唯一标识',
        IsEmpty: false
    },
    TerminalType: {
        type: Number,
        Name: '设备类型',
        IsEmpty: false,
        Enum: CBOEnum.TerminalType
    },
    ScanTime: {
        type: Date,
        Name: '扫描时间'
    },
    RequestTime: {
        type: Date,
        Name: '请求时间',
        IsEmpty: false
    },
    EndTime: {
        type: Date,
        Name: '执行完成时间'
    },
    ExecuteResult: {
        type: Number,
        Name: '执行结果',
        IsEmpty: false,
        Enum: CBOEnum.ExecuteResult
    },
    ExceptionInfo: {
        type: String,
        Name: '异常信息',
        trim: true
    },
    SerialNumber: {
        type: String,
        Name: '读头序号',
        trim: true
    },
    IsProcess: {
        type: Boolean,
        Name: '已处理'
    }
};

var newModel = new Model(modelField);
newModel.addIndex({ RequestTime: 1 });
newModel.create('DeviceMonitor', '设备监控信息');